#! /usr/local/bin/node
var config = require("./config");
const fs = require("fs");
const path = require("path");
var exec = require("child_process").exec,
	child;
// process.env.PATH += ":/usr/local/node/bin";
console.log(111)
child = exec("node ./script/twcss.js",function(err,stdout){
	console.log(stdout)
    // runAlltheme()
})
// child = exec("npx tailwindcss -i ./tailwindcss.css -o ../twcss.css --minify", function () {
// 	child = exec("lessc " + config.lessUrl + "/classic.less " + config.outPut + "/classic.css");
// 	child = exec("lessc " + config.lessUrl + "/technology.less " + config.outPut + "/technology.css");
// 	child = exec("lessc " + config.theme + "/technology2/technology2.less " + config.outPut + "/technology2.css");
// });



function runAlltheme(mypath = "./script") {
	const items = fs.readdirSync(mypath);

	let result = [];

	// 遍历当前目录中所有的文件和文件夹

	items.map((item) => {
		let temp = path.join(mypath, item);

		// 若当前的为文件夹

		// if (fs.statSync(temp).isDirectory()) {
        //     return;
		// 	result.push(item); // 存储当前文件夹的名字

		// 	// 进入下一级文件夹访问

		// 	result = result.concat(getAllDirs(temp));
		// }else{
        //     result.push(item);
        // }
        if(item.indexOf("theme") != -1){
            result.push(item);
            child = exec("node "+mypath+"/"+item, function(err, stdout, stderr) {
                if (err) throw err;
                console.log(stdout);
              });
        }
	});

	return result;
}

// console.log(getAllDirs());
